import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkingLotEquipmentVO, ParkingLotEquipmentForm, ParkingLotEquipmentQuery } from '@/api/access/parking-lot/parking-lot-equipment/types';

/**
 * 查询停车场-设备列表
 * @param query
 * @returns {*}
 */

export const listParkingLotEquipment = (query?: ParkingLotEquipmentQuery): AxiosPromise<ParkingLotEquipmentVO[]> => {
  return request({
    url: '/parking-lot/parking-lot-equipment/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询停车场-设备详细
 * @param parkingLotEquipmentId
 */
export const getParkingLotEquipment = (parkingLotEquipmentId: string | number): AxiosPromise<ParkingLotEquipmentVO> => {
  return request({
    url: '/parking-lot/parking-lot-equipment/' + parkingLotEquipmentId,
    method: 'get'
  });
};

/**
 * 新增停车场-设备
 * @param data
 */
export const addParkingLotEquipment = (data: ParkingLotEquipmentForm) => {
  return request({
    url: '/parking-lot/parking-lot-equipment',
    method: 'post',
    data: data
  });
};

/**
 * 修改停车场-设备
 * @param data
 */
export const updateParkingLotEquipment = (data: ParkingLotEquipmentForm) => {
  return request({
    url: '/parking-lot/parking-lot-equipment',
    method: 'put',
    data: data
  });
};

/**
 * 删除停车场-设备
 * @param parkingLotEquipmentId
 */
export const delParkingLotEquipment = (parkingLotEquipmentId: string | number | Array<string | number>) => {
  return request({
    url: '/parking-lot/parking-lot-equipment/' + parkingLotEquipmentId,
    method: 'delete'
  });
};

/**
 * 同步-设备
 */
export const synchronization = (query?: ParkingLotEquipmentQuery): AxiosPromise<ParkingLotEquipmentVO[]> => {
  return request({
    url: '/parking-lot/parking-lot-equipment/synchronization',
    method: 'get',
    params: query
  });
};
